package com.dingding.entity;

import com.dingding.enums.ResponseCode;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

@Data
public class BaseResponse<T> {

    @ApiModelProperty(value = "响应码")
    private String code;

    @ApiModelProperty(value = "响应描述")
    private String message = "";

    @ApiModelProperty(value = "成功返回对象")
    private T data;

    public BaseResponse(ResponseCode code) {
        this.code = code.getCode();
        this.message = code.getMessage();
    }

    public BaseResponse(ResponseCode code, String message) {
        this.code = code.getCode();
        this.message = message;
    }

    public BaseResponse(ResponseCode code, T data) {
        this.code = code.getCode();
//        this.message = code.getMessage();
        this.data = data;
    }
}
